<!--
 * @Author: xuzehan h935351619@163.com
 * @Date: 2025-11-04 13:27:32
 * @LastEditors: xuzehan h935351619@163.com
 * @LastEditTime: 2025-11-09 17:58:13
 * @FilePath: \hardware_monitoring\src\views\TestUserCase\modules\TestUserCaseModal.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <test-user-case-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></test-user-case-form>
  </j-modal>
</template>

<script>
import TestUserCaseForm from './TestUserCaseForm'
export default {
  name: 'TestUserCaseModal',
  components: {
    TestUserCaseForm
  },
  data() {
    return {
      title: '',
      width: 800,
      visible: false,
      disableSubmit: false
    }
  },
  methods: {
    add(type) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.add(type)
      })
    },
    edit(record, type) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.realForm.edit(record, type)
      })
    },
    close() {
      this.$emit('close')
      this.visible = false
    },
    handleOk() {
      this.$refs.realForm.submitForm()
    },
    submitCallback() {
      this.$emit('ok')
      this.visible = false
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
